<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="cn">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>企业合作成果参与人 </title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.7 -->
    <link rel="stylesheet" th:href="@{/asserts/bower_components/bootstrap/dist/css/bootstrap.min.css}">
    <!-- jQuery 3 -->
    <script th:src="@{/asserts/bower_components/jquery/dist/jquery.min.js}"></script>
    <!-- Bootstrap 3.3.7 -->
    <script th:src="@{/asserts/bower_components/bootstrap/dist/js/bootstrap.min.js}"></script>
    <!-- Font Awesome -->
    <link rel="stylesheet" th:href="@{/asserts/bower_components/font-awesome/css/font-awesome.min.css}">
    <!-- Ionicons -->
    <link rel="stylesheet" th:href="@{/asserts/bower_components/Ionicons/css/ionicons.min.css}">
    <!-- DataTables -->
    <link rel="stylesheet" th:href="@{/asserts/bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css}">
    <!-- Theme style -->
    <link rel="stylesheet" th:href="@{/asserts/dist/css/AdminLTE.min.css}">
    <!-- AdminLTE Skins. Choose a skin from the css/skins
         folder instead of downloading all of them to reduce the load. -->
    <link rel="stylesheet" th:href="@{/asserts/dist/css/skins/_all-skins.min.css}">

    <!--MyScript-->
    <script th:src="@{/asserts/Apolar_sh/lib/js/bigautocomplete.js}"></script>
    <script th:src="@{/asserts/Apolar_sh/lib/layer/2.4/layer.js}"></script>
    <link rel="stylesheet" th:href="@{/asserts/Apolar_sh/lib/css/input.css}">
    <link rel="stylesheet" th:href="@{/asserts/Apolar_sh/lib/css/bigautocomplete.css}" type="text/css"/>
    <!-- Google Font -->
    <link rel="stylesheet"
          href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
    <style type="text/css">

        * {
            margin: 0;
            padding: 0;
            list-style-type: none;
        }

        #myTable td {
            text-align: center;
        }

        th {
            text-align: center;
        }

        #top {
            background-color: rgba(172, 175, 175, 0.78);
            display: none;
            position: fixed;
            right: -3px;
            bottom: 45px;
            z-index: 9999;
        }

        #top a {
            color: rgba(61, 61, 61, 0.91);
            font-size: 45px;
        }

        #refresh {
            display: block;
            position: absolute;
            right: 10px;
            top: 10px;
            z-index: 9999;
            font-size: 26px;
        }
    </style>

</head>
<body>
<a id="up"></a>
<div id="top">
    <a href="#up" title="回到顶部" class="fa fa-angle-double-up"></a>
</div>
<span>
    <a id="refresh" class="fa fa-refresh" href="javascript:location.reload()"></a>
</span>
<div class="wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h4>
            <i class="fa fa-navicon"></i> 参与人详情
        </h4>
        <span style="margin: 0 0 0 0;">
            <a th:if="${comId==null&&ccrcDate==null&&ccrcCourseTeacher==null&&ccrcTopic==null&&ccrcSales==null}" class="btn btn-info btn-sm"
               th:href="@{/cc/ccShow(comId=${comId},ccCrId=${ccCrId},currentPage=${currentPage},pageSize=${pageSize})}">
                <i class="fa fa-backward"></i> 返回
            </a>
            <a th:if="${comId!=null||ccrcDate!=null||ccrcCourseTeacher!=null||ccrcTopic!=null||ccrcSales!=null}" class="btn btn-info btn-sm"
               th:href="@{/cc/ccShow(ccCrId=${ccCrId},comId=${comId},ccrcDate=${ccrcDate}, ccrcCourseTeacher=${ccrcCourseTeacher},ccrcTopic=${ccrcTopic},ccrcSales=${ccrcSales},currentPage=${currentPage},pageSize=${pageSize})}">
                <i class="fa fa-backward"></i> 返回
            </a>
            <a class="btn btn-info btn-sm" data-toggle="modal"
               data-target="#addModal"><i class="fa fa-plus"></i> 添加参与人</a>
        </span>
        <!-- Modal -->
        <div class="modal fade" id="addModal" tabindex="-1"
             role="dialog" data-backdrop='static'
             aria-labelledby="myModalLabel">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h4 class="modal-title" id="myModalLabel" style="text-align: center"><i
                                class="fa fa-edit"></i> 添加参与人信息
                        </h4>
                    </div>
                    <div class="modal-body">
                        <div class="row">
                            <div class="col-sm-12">
                                <div class="box" style="width: 80%;margin: 0 auto;">
                                    <div class="box-body">
                                        <form class="form-horizontal" id="addForm">
                                            <input type="text"
                                                   name="ccId"
                                                   th:value="${ccId}" hidden>
                                            <div class="form-group">
                                                <label class="col-sm-3 control-label"><span
                                                        style="color: red;">*</span>
                                                    姓名：</label>
                                                <div class="col-sm-8">
                                                    <input type="text" class="form-control"
                                                           id="coContactNameAdd"
                                                           name="coContactName"
                                                           placeholder="请输入参与人姓名"
                                                           style="width: 280px">
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label class="col-sm-3 control-label">
                                                    性别：</label>
                                                <div class="col-sm-3">
                                                    <input type="radio" id="genderMaleAdd"
                                                           th:name="coContactGender"
                                                           th:value="男"
                                                           checked><label for="genderMaleAdd"><i
                                                        class="mimg"></i></label>
                                                    &nbsp;&nbsp;&nbsp;&nbsp;
                                                    <input type="radio" id="genderFemaleAdd"
                                                           th:name="coContactGender"
                                                           th:value="女"><label for="genderFemaleAdd"><i
                                                        class="wimg"></i></label>
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label class="col-sm-3 control-label">
                                                    职务：</label>
                                                <div class="col-sm-8">
                                                    <input type="text" class="form-control"
                                                           autocomplete="off"
                                                           id="coContactDuty"
                                                           name="coContactDuty"
                                                           placeholder="请输入参与人职务" style="width: 280px">
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label class="col-sm-3 control-label">
                                                    电话：</label>
                                                <div class="col-sm-8">
                                                    <input type="text" class="form-control"
                                                           autocomplete="off"
                                                           id="coContactPhone"
                                                           name="coContactPhone"
                                                           placeholder="请输入参与人电话" style="width: 280px"
                                                           onchange="if(!(/^1[3,5,7,8]\d{9}$/.test(value))){layer.msg('号码格式不对哦!请重新输入', {icon: 0, time: 1500});value='';}">
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label class="col-sm-3 control-label">
                                                    微信：</label>
                                                <div class="col-sm-8">
                                                    <input type="text" class="form-control"
                                                           autocomplete="off"
                                                           id="coContactWechat"
                                                           name="coContactWechat"
                                                           placeholder="请输入参与人微信" style="width: 280px">
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label class="col-sm-3 control-label">
                                                    QQ：</label>
                                                <div class="col-sm-8">
                                                    <input type="tel" class="form-control"
                                                           autocomplete="off"
                                                           id="coContactQq"
                                                           name="coContactQq"
                                                           placeholder="请输入参与人QQ" style="width: 280px"
                                                           onchange="if(!(/^[1-9]\d{5,11}$/.test(value))){layer.msg('QQ格式不对哦!请重新输入', {icon: 0, time: 1500});value='';}">
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label class="col-sm-3 control-label">
                                                    邮箱：</label>
                                                <div class="col-sm-8">
                                                    <input type="email" class="form-control"
                                                           autocomplete="off"
                                                           id="coContactEmail"
                                                           name="coContactEmail"
                                                           placeholder="请输入参与人邮箱" style="width: 280px"
                                                           onchange="if(!(/^[a-zA-Z0-9_-]+@([a-zA-Z0-9]+\.)+(com|cn|net|org)$/.test(value))){layer.msg('邮箱格式不对哦，请重新输入', {icon: 0, time: 1500});value='';}">
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label class="col-sm-3 control-label">
                                                    备注：</label>
                                                <div class="col-sm-8">
                                                     <textarea class="form-control" rows="3"
                                                               cols="60"
                                                               id="coContactRemarks"
                                                               name="coContactRemarks"
                                                               placeholder="请输入备注信息" style="width: 280px"></textarea>
                                                </div>
                                            </div>
                                        </form>
                                    </div>
                                    <!-- /.box-body -->
                                </div>
                                <!-- /.box -->
                            </div>
                            <!-- /.col -->
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default btn-sm"
                                data-dismiss="modal">
                            &nbsp;&nbsp;关&nbsp;&nbsp;&nbsp;闭&nbsp;&nbsp;
                        </button>
                        <button type="button" class="btn btn-success btn-sm"
                                th:onclick="addSubmit()">
                            <i class="fa fa-check-square"></i>&nbsp;&nbsp;&nbsp;提&nbsp;&nbsp;&nbsp;交&nbsp;&nbsp;
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </section>
</div>
<div class="wrapper">
    <!-- Content Wrapper. Contains page content -->
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <div th:if="${info!=null}" class="box-body" style="color: red;font-size: 20px;">[[${info}]]
                    </div>
                    <div th:if="${info==null}" class="box-body">
                        <table id="myTable" class="table table-bordered table-striped">
                            <thead>
                            <tr>
                                <th>选择</th>
                                <th>姓名</th>
                                <th>性别</th>
                                <th>职务</th>
                                <th>电话</th>
                                <th>微信</th>
                                <th>QQ</th>
                                <th>邮箱</th>
                                <th>备注</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr th:each="contact:${contactList}">
                                <td>
                                    <input type="checkbox" name="cpIds" th:value="${contact.ccpId}"
                                           id="checkId"
                                           th:onchange="recordId(this)">
                                </td>
                                <td th:text="${contact.coContactName}"></td>
                                <td th:text="${contact.coContactGender}"></td>
                                <td th:text="${contact.coContactDuty}"></td>
                                <td th:text="${contact.coContactPhone}"></td>
                                <td th:text="${contact.coContactWechat}"></td>
                                <td th:text="${contact.coContactQq}"></td>
                                <td th:text="${contact.coContactEmail}"></td>
                                <td th:text="${contact.coContactRemarks}"></td>
                                <td>
                                    <a class="btn btn-warning btn-xs"
                                       data-toggle="modal"
                                       th:data-target="${'#modifyModal'+contact.coContactId}">
                                        <i class="fa fa-edit"></i> 修改
                                    </a>
                                    <a th:if="${session.user.authority!=3}" class="btn btn-danger btn-xs"
                                       th:onclick="cp_delete(this,[[${contact.ccpId}]])">
                                        <i class="fa fa-trash"></i> 删除
                                    </a>
                                    <!-- Modal -->
                                    <div class="modal fade" th:id="${'modifyModal'+contact.coContactId}" tabindex="-1"
                                         role="dialog" data-backdrop='static'
                                         aria-labelledby="myModalLabel">
                                        <div class="modal-dialog" role="document">
                                            <div class="modal-content">
                                                <div class="modal-header">
                                                    <h4 class="modal-title" id="myModalLabel"
                                                        style="text-align: center"><i
                                                            class="fa fa-edit"></i> 修改参与人信息
                                                    </h4>
                                                </div>
                                                <div class="modal-body">
                                                    <div class="row">
                                                        <div class="col-sm-12">
                                                            <div class="box" style="width: 80%;margin: 0 auto;">
                                                                <div class="box-body">
                                                                    <form class="form-horizontal"
                                                                          th:id="${'modifyForm'+contact.coContactId}">
                                                                        <input type="text" id="coContactId"
                                                                               name="coContactId"
                                                                               th:value="${contact.coContactId}" hidden>
                                                                        <div class="form-group">
                                                                            <label class="col-sm-3 control-label"><span
                                                                                    style="color: red;">*</span>
                                                                                姓名：</label>
                                                                            <div class="col-sm-8">
                                                                                <input type="text" class="form-control"
                                                                                       autocomplete="off"
                                                                                       th:id="${'coContactName'+contact.coContactId}"
                                                                                       name="coContactName"
                                                                                       placeholder="请输入参与人姓名"
                                                                                       th:value="${contact.coContactName}">
                                                                            </div>
                                                                        </div>
                                                                        <div class="form-group">
                                                                            <label class="col-sm-3 control-label">
                                                                                性别：</label>
                                                                            <div class="col-sm-3">
                                                                                <input type="radio"
                                                                                       id="genderMaleModify"
                                                                                       th:name="coContactGender"
                                                                                       th:value="男"
                                                                                       th:checked="${contact.coContactGender=='男'}"><label
                                                                                    for="genderMaleModify"><i
                                                                                    class="mimg"></i></label>
                                                                                &nbsp;&nbsp;&nbsp;&nbsp;
                                                                                <input type="radio"
                                                                                       id="genderFemaleModify"
                                                                                       th:name="coContactGender"
                                                                                       th:value="女"
                                                                                       th:checked="${contact.coContactGender=='女'}"><label
                                                                                    for="genderFemaleModify"><i
                                                                                    class="wimg"></i></label>
                                                                            </div>
                                                                        </div>
                                                                        <div class="form-group">
                                                                            <label class="col-sm-3 control-label">
                                                                                职务：</label>
                                                                            <div class="col-sm-8">
                                                                                <input type="text" class="form-control"
                                                                                       autocomplete="off"
                                                                                       name="coContactDuty"
                                                                                       placeholder="请输入参与人职务"
                                                                                       th:value="${contact.coContactDuty}">
                                                                            </div>
                                                                        </div>
                                                                        <div class="form-group">
                                                                            <label class="col-sm-3 control-label">
                                                                                电话：</label>
                                                                            <div class="col-sm-8">
                                                                                <input type="text" class="form-control"
                                                                                       autocomplete="off"
                                                                                       name="coContactPhone"
                                                                                       placeholder="请输入参与人电话"
                                                                                       th:value="${contact.coContactPhone}"
                                                                                       onchange="if(!(/^1[3,5,7,8]\d{9}$/.test(value))){layer.msg('号码格式不对哦!请重新输入', {icon: 0, time: 1500});value='';}">
                                                                            </div>
                                                                        </div>
                                                                        <div class="form-group">
                                                                            <label class="col-sm-3 control-label">
                                                                                微信：</label>
                                                                            <div class="col-sm-8">
                                                                                <input type="text" class="form-control"
                                                                                       autocomplete="off"
                                                                                       name="coContactWechat"
                                                                                       placeholder="请输入参与人微信"
                                                                                       th:value="${contact.coContactWechat}">
                                                                            </div>
                                                                        </div>
                                                                        <div class="form-group">
                                                                            <label class="col-sm-3 control-label">
                                                                                QQ：</label>
                                                                            <div class="col-sm-8">
                                                                                <input type="tel" class="form-control"
                                                                                       autocomplete="off"
                                                                                       name="coContactQq"
                                                                                       placeholder="请输入参与人QQ"
                                                                                       th:value="${contact.coContactQq}"
                                                                                       onchange="if(!(/^[1-9]\d{5,11}$/.test(value))){layer.msg('QQ格式不对哦!请重新输入', {icon: 0, time: 1500});value='';}">
                                                                            </div>
                                                                        </div>
                                                                        <div class="form-group">
                                                                            <label class="col-sm-3 control-label">
                                                                                邮箱：</label>
                                                                            <div class="col-sm-8">
                                                                                <input type="email" class="form-control"
                                                                                       autocomplete="off"
                                                                                       name="coContactEmail"
                                                                                       placeholder="请输入参与人邮箱"
                                                                                       th:value="${contact.coContactEmail}"
                                                                                       onchange="if(!(/^[a-zA-Z0-9_-]+@([a-zA-Z0-9]+\.)+(com|cn|net|org)$/.test(value))){layer.msg('邮箱格式不对哦，请重新输入', {icon: 0, time: 1500});value='';}">
                                                                            </div>
                                                                        </div>
                                                                        <div class="form-group">
                                                                            <label class="col-sm-3 control-label">
                                                                                备注：</label>
                                                                            <div class="col-sm-8">
                                                                                <textarea class="form-control" rows="3"
                                                                                          cols="60"
                                                                                          name="coContactRemarks"
                                                                                          placeholder="请输入备注信息">[[${contact.coContactRemarks}]]</textarea>
                                                                            </div>
                                                                        </div>
                                                                    </form>
                                                                </div>
                                                                <!-- /.box-body -->
                                                            </div>
                                                            <!-- /.box -->
                                                        </div>
                                                        <!-- /.col -->
                                                    </div>
                                                </div>
                                                <div class="modal-footer">
                                                    <button type="button" class="btn btn-default btn-sm"
                                                            data-dismiss="modal">
                                                        &nbsp;&nbsp;关&nbsp;&nbsp;&nbsp;闭&nbsp;&nbsp;
                                                    </button>
                                                    <button id="gradeBtn" type="button" class="btn btn-success btn-sm"
                                                            th:onclick="modifySubmit([[${contact.coContactId}]])">
                                                        <i class="fa fa-check-square"></i>&nbsp;&nbsp;&nbsp;提&nbsp;&nbsp;&nbsp;交&nbsp;&nbsp;
                                                    </button>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </td>
                            </tr>
                            </tbody>
                            <tfoot>
                            <tr th:if="${session.user.authority!=3}">
                                <td>
                                    <input type="checkbox" name="" id="checkAllId" value=""
                                           onchange="checkAllId(this)">
                                </td>
                                <td colspan="9" style="text-align:left;padding-left:20px;">
                                    <button class="btn btn-danger btn-sm" th:onclick="cps_Delete()">
                                        <i class="fa fa-trash"></i> 批量删除
                                    </button>&nbsp;&nbsp;
                                </td>
                            </tr>
                            <tr>
                            </tr>
                            </tfoot>
                        </table>
                    </div>
                    <!-- /.box-body -->
                </div>
                <!-- /.box -->
            </div>
            <!-- /.col -->
        </div>
        <!-- /.row -->
    </section>
    <!-- /.content -->
</div>

<!-- ./wrapper -->


<!-- DataTables -->
<script th:src="@{/asserts/bower_components/datatables.net/js/jquery.dataTables.min.js}"></script>
<script th:src="@{/asserts/bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js}"></script>
<!-- SlimScroll -->
<script th:src="@{/asserts/bower_components/jquery-slimscroll/jquery.slimscroll.min.js}"></script>
<!-- FastClick -->
<script th:src="@{/asserts/bower_components/fastclick/lib/fastclick.js}"></script>
<!-- AdminLTE App -->
<script th:src="@{/asserts/dist/js/adminlte.min.js}"></script>
<!-- AdminLTE for demo purposes -->
<script th:src="@{/asserts/dist/js/demo.js}"></script>
<!-- page script -->
<script>

    /*置顶*/
    $(function () {
        $(window).scroll(function () {
            if ($(window).scrollTop() > 150) {
                $('#top').css('display', 'block');    //<div id-'top'></div>假如有这么个div是那个向上图标的div。css默认none
            } else {
                $('#top').css('display', 'none');
            }
        });
    });

    var idArr = [];

    /*记住单个id*/
    function recordId(obj) {
        if (idArr.length === 0 || obj.checked === true) {
            idArr.push(obj.value);
        } else {
            for (var index in idArr) {
                if (idArr[index] === obj.value) {
                    delete idArr[index];
                }
            }
        }
    }

    /*记录所有id*/
    function checkAllId(obj) {

        var checknames = document.getElementsByName("cpIds");
        for (var i = 0; i < checknames.length; i++) {
            checknames[i].checked = obj.checked;
            if (obj.checked) {
                idArr.push(checknames[i].value);
            } else {
                idArr.length = 0;
            }
        }
    }

    /*删除-批量*/
    function cps_Delete() {
        var flag = true;
        for (var index in idArr) {
            if (idArr[index] != null) {
                flag = false;
            }
        }
        if (idArr.length === 0 || flag) {
            layer.msg('亲，请先选择要删除的项哦!', {
                icon: 0,
                time: 1500
            });
        } else {
            layer.confirm("确认要删除吗？",
                {
                    btn: ['确定', '取消']
                },
                function () {
                    var cpIdStr = idArr.toString();
                    $.ajax({
                        type: 'POST',
                        url: './cpsDelete',
                        data: {
                            cpIdStr: cpIdStr
                        },
                        success: function (data) {
                            if (data.id === 0) {
                                layer.msg(data.data, {
                                    icon: 1,
                                    time: 500
                                });
                                setTimeout(function () {
                                    location.replace(location.href);
                                }, 500);
                            } else {
                                layer.msg(data.data, {
                                    icon: 0,
                                    time: 2000
                                });
                            }
                        },
                        error: function (data) {
                            console.log(data.msg);
                        }
                    });
                },
                function () {
                    layer.msg("已取消！", {
                        icon: 0,
                        time: 500
                    });
                    return false;
                }
            );
        }
    }

    /*删除-单个*/
    function cp_delete(obj, cpId) {
        layer.confirm("确认要删除吗？",
            {
                btn: ['确定', '取消']
            },
            function () {
                $.ajax({
                    type: 'POST',
                    url: './cpDelete',
                    data: {
                        cpId: cpId
                    },
                    success: function (data) {
                        if (data.id === 0) {
                            layer.msg(data.data, {
                                icon: 1,
                                time: 500
                            });
                            setTimeout(function () {
                                location.replace(location.href);
                            }, 500);
                        } else {
                            layer.msg(data.data, {
                                icon: 0,
                                time: 2000
                            });
                        }
                    },
                    error: function (data) {
                        console.log(data.msg);
                    }
                });
            },
            function () {
                layer.msg("已取消！", {
                    icon: 0,
                    time: 500
                });
                return false;
            }
        );
    }

    /*修改*/
    function modifySubmit(coContactId) {
        var coContactName = $("#coContactName" + coContactId).val();
        if ((coContactName == null || coContactName === "")) {
            layer.msg('亲，姓名不能为空哦!', {
                icon: 0,
                time: 1500
            });
        } else {
            $.ajax({
                type: 'POST',
                url: './cpModify',
                data: $("#modifyForm" + coContactId).serialize(),
                success: function (data) {
                    if (data.id === 0) {
                        layer.msg(data.data, {
                            icon: 1,
                            time: 500
                        });
                        $('#modifyModal' + coContactId).modal('hide');
                        setTimeout(function () {
                            location.replace(location.href);
                        }, 500);
                    } else {
                        layer.msg(data.data, {
                            icon: 0,
                            time: 2000
                        });
                        $('#modifyModal' + coContactId).modal('hide');
                    }
                },
                error: function (data) {
                    console.log(data.msg);
                }
            })
        }
    }

    var $coContactNameAdd = $("#coContactNameAdd");

    /*添加*/
    function addSubmit() {
        var coContactName = $coContactNameAdd.val();
        if ((coContactName == null || coContactName === "")) {
            layer.msg('亲，姓名不能为空哦!', {
                icon: 0,
                time: 1500
            });
        } else {
            $.ajax({
                type: 'POST',
                url: './cpAdd',
                data: $("#addForm").serialize(),
                success: function (data) {
                    if (data.id === 0) {
                        layer.msg(data.data, {
                            icon: 1,
                            time: 500
                        });
                        $('#addModal').modal('hide');
                        setTimeout(function () {
                            location.replace(location.href);
                        }, 500);
                    } else {
                        layer.msg(data.data, {
                            icon: 0,
                            time: 2000
                        });
                        $('#addModal').modal('hide');
                    }
                },
                error: function (data) {
                    console.log(data.msg);
                }
            })
        }
    }

    /*联想输入*/
    $(function () {
        $coContactNameAdd.bigAutocomplete({
            url: '[[${#httpServletRequest.getContextPath()}]]/find/contactNameJson',
        });
    })

    /*姓名查询补齐*/
    $coContactNameAdd.focus(function () {
        document.getElementById("coContactNameAdd").value = "";
    });
    var coContactNameAdd = "";
    $coContactNameAdd.blur(function () {
        setTimeout(function () {
            coContactNameAdd = $coContactNameAdd.val();
            $.ajax({
                type: 'POST',
                url: './cpSearch',
                data: {
                    coContactNameAdd: coContactNameAdd,
                },
                success: function (data) {
                    if (data.id === 0) {
                        if (data.data.coContactGender === '男') {
                            document.getElementById("genderMaleAdd").checked = true;
                        } else {
                            document.getElementById("genderFemaleAdd").checked = true;
                        }
                        document.getElementById("coContactDuty").value = data.data.coContactDuty;
                        document.getElementById("coContactPhone").value = data.data.coContactPhone;
                        document.getElementById("coContactWechat").value = data.data.coContactWechat;
                        document.getElementById("coContactQq").value = data.data.coContactQq;
                        document.getElementById("coContactEmail").value = data.data.coContactEmail;
                        document.getElementById("coContactRemarks").value = data.data.coContactRemarks;
                    }
                },
                error: function (data) {
                    console.log(data.msg);
                }
            })
        }, 500);
    });
</script>
</body>
</html>